<script lang="ts">
	import { Any } from '$lib/api/proto/google/protobuf/any';
	import { SimpleQuestion } from '$lib/api/proto/resource_exam_type_api';

	interface Props {
		question: Any;
	}
	let props: Props = $props();

	let question = $state(Any.unpack(props.question, SimpleQuestion));

	$effect(() => {
		question = Any.unpack(props.question, SimpleQuestion);
	});
</script>

<div class="prose max-w-none p-2 w-full">
	<h3>问题:{question.question}</h3>
	{#if question.sampleAnswer.trim() != ''}
		<h4>参考答案</h4>
		<pre class="bg-base-100 text-primary">{question.sampleAnswer}</pre>
	{/if}
</div>
